package com.example.administrator.myapplication.guide;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;

import com.example.administrator.myapplication.HomeActivity;
import com.example.administrator.myapplication.R;

public class GuideFragment extends Fragment {
    private int[] guide_bg = {R.drawable.guide_bg_first, R.drawable.guide_bg_heart, R.drawable.guide_bg_muscle, R.drawable.guide_bg_flexbility, R.drawable.guide_bg_body};
    private Button bt_enter;
    private RelativeLayout guide_rl;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_guide, container, false);
        bt_enter = (Button) view.findViewById(R.id.guide_enter_bt);
        guide_rl = (RelativeLayout) view.findViewById(R.id.rl_guide);

        int index = getArguments().getInt("index");
        System.out.println (index + "aaaaaaaaaaaaaaaaaaaaaaa");
      // guide_rl.setBackgroundResource(guide_bg[index]);
        bt_enter.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(), HomeActivity.class));
            }
        });
        bt_enter.setVisibility(index == 4 ? View.VISIBLE:View.GONE);      ///设置按钮在最后一个导航页才出现
        return view;
    }

}
